#!/usr/bin/env perl

use strict;
use warnings;





#perl variable types - SCALARS,ARRAYS & HASHES

#HASHES

#ARRAYS - arrays are zero-index based
my @animals = ("camel", "llama", "owl","antelope");
my @numbers = (23, 42, 69);
my @mixed   = ("camel", 42, 1.23);



my @animalsSorted = sort @animals;
print  "@animalsSorted\n";

#Array slice - fetching multiple items from an array
print "@animals\n";
print "@animals[1,2]\n";
print "@animals[0..2]\n";

#fetching single scalar values
print "$animals[0]\n"; #get the value at index 0
print "$animals[1]\n"; #get the value at index 1
print "Last element is: $mixed[$#mixed]\n";

#size of an array
print "Size of the arrays is: $#animals\n";


__END__
#SCALARS
my $animal="camel";
my $answer=9;
print "$animal - $answer\n";
print "Square of answer is ", $answer * $answer, "\n";


__END__
#Perl intro
my $name="Joshua";
print "My name is $name\n"; #this works fine
print 'My name is $name\n' #this does work but does not do interpolation


